#define _CRT_SECURE_NO_WARNINGS 1
struct ListNode* FindKthToTail(struct ListNode* pListHead, int k) {
    // write code here
    if (pListHead == NULL)
    {
        return NULL;
    }
    if (pListHead->next == NULL)
    {
        return pListHead;
    }
    struct ListNode* cur = pListHead;
    struct ListNode* tail = pListHead;
    int count = 1;
    while (cur->next != NULL)
    {
        cur = cur->next;
        count++;
    }
    if (k > count)
    {
        return NULL;
    }
    int i = 0;
    for (i = 0; i < count - k; i++)
    {
        tail = tail->next;
    }
    return tail;

}